local skel = fk.CreateSkill{
    name="binglinchengxia_skill",
}

skel:addEffect("cardskill", {
    prompt = "#indulgence_skill",
    mod_target_filter = function(self, player, to_select, selected, card, distance_limited)
      return to_select ~= player
    end,
    target_filter = Util.CardTargetFilter,
    target_num = 1,
    on_effect = function(self, room, effect)
        local to = effect.to
        local judge = {
          who = to,
          reason = "binglinchengxia",
          pattern = ".|.|^diamond",
        }
        room:judge(judge)
        local result = judge.card
        if result.suit ~= Card.Diamond then
          local chc = { "losehp" }
          if #to.player_cards[Player.Equip] > 0 then
            table.insert(chc, "throw_equips")
          end
          local chs = room:askForChoice(to, chc, self.name)
          if chs == "throw_equips" then
            to:throwAllCards("e")
          else
            -- room:loseHp(to,1,self.name)
            room:damage({
              from = nil,
              to = to,
              -- card = effect.card,
              damage = 1,
              damageType = fk.FireDamage,
              skillName = self.name
            })
          end
        else
          if effect.card:isVirtual() then
            to:addVirtualEquip(effect.card)
          end
          -- room:moveCards{
          -- ids = room:getSubcardsByRule(effect.card, { Card.Processing }),
          -- to = effect.to,
          -- toArea = Card.PlayerJudge,
          -- moveReason = fk.ReasonPut }
        end
        self:onNullified(room, effect)
      end,
    on_nullified = function(self, room, effect)
        room:moveCards {
          ids = room:getSubcardsByRule(effect.card, { Card.Processing }),
          toArea = Card.DiscardPile,
          moveReason = fk.ReasonUse
        }
      end,
})


Fk:loadTranslationTable {
    ["binglinchengxia"] = "兵临城下",
    ["binglinchengxia_skill"] = "兵临城下",
    ["#binglinchengxia_skill"] = "将此牌置入目标的判定区，其判定阶段进行判定：<br>若不为♦，其选择弃置所有装备或受到一点火属性伤害",
    ["throw_equips"] = "失去所有装备",
    ["losehp"] = "受到1点火属性伤害",
    [":binglinchengxia"] = "延时锦囊牌<br /><b>时机</b>：出牌阶段<br /><b>目标</b>：一名其他角色<br /><b>效果</b>：将此牌置入目标的判定区，其判定阶段进行判定，若不为方片，其选择弃置所有装备或受到一点火属性伤害(无装备直接受伤)，然后将此牌置入弃牌堆",
  }
  

return skel